From: Jan Beulich Date: Mon, 26 Sep 2016 15:27:06 +0000 (+0200) Subject: x86emul: don't allow null selector for LTR X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~348 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https://%22%22/%22http:/www.example.com/cgi/%22https:/%22%22?a=commitdiff_plain;h=dcfd9a5eadedc71d8546286b881bba7db152207a;p=xen.git x86emul: don't allow null selector for LTR Signed-off-by: Jan Beulich Reviewed-by: Konrad Rzeszutek Wilk Reviewed-by: Andrew Cooper --- diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c index 9c76c2e032..b22ede659b 100644 --- a/xen/arch/x86/x86_emulate/x86_emulate.c +++ b/xen/arch/x86/x86_emulate/x86_emulate.c @@ -1207,10 +1207,17 @@ protmode_load_seg( /* NULL selector? */ if ( (sel & 0xfffc) == 0 ) { - if ( (seg == x86_seg_cs) || - ((seg == x86_seg_ss) && - (!mode_64bit() || (cpl == 3) || (cpl != sel))) ) + switch ( seg ) + { + case x86_seg_ss: + if ( mode_64bit() && (cpl != 3) && (cpl == sel) ) + default: + break; + /* fall through */ + case x86_seg_cs: + case x86_seg_tr: goto raise_exn; + } memset(sreg, 0, sizeof(*sreg)); sreg->sel = sel; return X86EMUL_OKAY;